Dim arPDF As GdPicturePDF() = New GdPicturePDF(2) {}
arPDF(0) = New GdPicturePDF()
arPDF(1) = New GdPicturePDF()
arPDF(2) = New GdPicturePDF()
If (arPDF(0).LoadFromFile("test1.pdf", False) = GdPictureStatus.OK) AndAlso
(arPDF(1).LoadFromFile("test2.pdf", False) = GdPictureStatus.OK) AndAlso
(arPDF(2).LoadFromFile("test3.pdf", False) = GdPictureStatus.OK) Then
Dim dstPDF As GdPicturePDF = arPDF(0).MergeDocuments(arPDF, PdfDocumentMergingOptions.ExcludeAttachments)
'You can use also arPDF[1] or arPDF[2] object to call the MergeDocuments method.
Dim status As GdPictureStatus = arPDF(0).GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("All documents have been successfully merged.", "Example: MergeDocuments")
If dstPDF.SaveToFile("test_merged.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Merged document has been successfully saved.", "Example: MergeDocuments")
dstPDF.CloseDocument()
End If
Else
MessageBox.Show("The MergeDocuments() method has failed with the status: " + status.ToString(), "Example: MergeDocuments")
End If
dstPDF.Dispose()
arPDF(2).CloseDocument()
arPDF(1).CloseDocument()
arPDF(0).CloseDocument()
Else
MessageBox.Show("Loading of the source documents has failed.", "Example: MergeDocuments")
End If
arPDF(2).Dispose()
arPDF(1).Dispose()
arPDF(0).Dispose()
GdPicturePDF[] arPDF = new GdPicturePDF[3];
arPDF[0] = new GdPicturePDF();
arPDF[1] = new GdPicturePDF();
arPDF[2] = new GdPicturePDF();
if ((arPDF[0].LoadFromFile("test1.pdf", false) == GdPictureStatus.OK) &&
(arPDF[1].LoadFromFile("test2.pdf", false) == GdPictureStatus.OK) &&
(arPDF[2].LoadFromFile("test3.pdf", false) == GdPictureStatus.OK))
{
GdPicturePDF dstPDF = arPDF[0].MergeDocuments(arPDF, PdfDocumentMergingOptions.ExcludeAttachments);
//You can use also arPDF[1] or arPDF[2] object to call the MergeDocuments method.
GdPictureStatus status = arPDF[0].GetStat();
if (status == GdPictureStatus.OK)
{
MessageBox.Show("All documents have been successfully merged.", "Example: MergeDocuments");
if (dstPDF.SaveToFile("test_merged.pdf") == GdPictureStatus.OK)
{
MessageBox.Show("Merged document has been successfully saved.", "Example: MergeDocuments");
dstPDF.CloseDocument();
}
}
else
{
MessageBox.Show("The MergeDocuments() method has failed with the status: " + status.ToString(), "Example: MergeDocuments");
}
dstPDF.Dispose();
arPDF[2].CloseDocument();
arPDF[1].CloseDocument();
arPDF[0].CloseDocument();
}
else
{
MessageBox.Show("Loading of the source documents has failed.", "Example: MergeDocuments");
}
arPDF[2].Dispose();
arPDF[1].Dispose();
arPDF[0].Dispose();